#pragma once

#include <interface/interface.h>
#include <interface/web_service_interface.h>

class update_report_dlg;

class update_impl
{
public:
	update_impl(void);

	~update_impl(void);

public:
	int set_window_hwnd( HWND hwnd );

	bool on_run_trueupdate_client();

public:
	bool on_login_update_msg(aot::tt::command_t* cmd, aot::tt::result_t* ret );

	bool on_search_update_msg( WPARAM wparam , LPARAM lparam );

	void on_child_dlg_destroy_msg( int mode_ );
	
private:
	int GetProcessCount(const TCHAR* szExeName);

	std::string  get_web_url();

	std::string get_min_version_by_locad();	

	std::string get_new_version_by_locad();

	std::string get_local_sid();

	std::string get_locad_version();

	int get_cur_downtype( int def_val = 0);

	void set_cur_downtype( int uptype_ );

	void set_online_upgrade( int val_ = 1 );

	void set_locad_version( const char * ver );

private:

	HWND window_hwnd_;

	std::string ver_fn_;
	std::string web_fn_;
	std::string ver_info_fn_;  ///

	std::string loacl_ver_;
	std::string web_ver_;

	update_report_dlg *    report_prompt_dlg_;
	update_report_dlg *    report_normal_dlg_;
	update_report_dlg *    report_must_dlg_;
	aot::tt::iobj_auto_ptr<aot::rpc::iweb_rpc> ptr_web_rpc;
};
